package com.wcfsy.wechat.wx.job;

import jdk.nashorn.internal.ir.annotations.Reference;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.wcfsy.wechat.wx.service.CourseService;
import com.wcfsy.wechat.wx.util.WechatUtil;

@Component
public class CourseQuartz {

	@Reference
	private CourseService courseService;
	
	Logger logger = LoggerFactory.getLogger(this.getClass());
	
	public void execute() {
			logger.info("....................微信配置定时器start....................");
			WechatUtil.poolThreadExecutor.execute(new Runnable() {
				@Override
				public void run() {
				try {
						Thread.sleep(10000);
					try {
							courseService.pushCourseTime();
					} catch (Exception e) {
							logger.warn("重新跑一次", e);
							courseService.pushCourseTime();
					}
				} catch (Exception e1) {
				}
			}
		});
	}
}
